<%-- 
    Document   : ResultSearchCar
    Created on : Nov 2, 2011, 12:11:22 AM
    Author     : MrKoi
--%>

<%@page import="DAL.CarBean"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ page session="true" import="java.util.Collection" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="f" %>
<%@ taglib uri="/WEB-INF/taglib139.tld" prefix="pg" %>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
       <title>East2West Tours and Travels</title>
        <style type="text/css">
            #Table
            {
            border:1px solid green;
            }
            th
            {
             border:1px solid green;
            background-color:green;
            color:white;
            }
            .td
            {
             border:1px solid green;
            }
            .font
            {
                font-family:"Times New Roman", Times, serif;
                font-size:x-large;
                font-weight:bold;
                width:200px;
                margin-left:auto;
                margin-right:auto;
                color:#0707e7;
            }
            .center
            {
                margin-top:10px;
                margin-left:auto;
                margin-right:auto;
            }
            .a
            {
            color:#0707e7;
            }
        </style>
    </head>
    <body>
    <%
                 CarBean cb=new CarBean();
                 String condition="",driver="",Seatfrom="",Seatto="",CarType="",ModelCar=""; 
                  
                  condition=session.getAttribute("condition").toString();
                  //driver=session.getAttribute("driver").toString();
                  Seatfrom=session.getAttribute("Seatfrom").toString();
                  Seatto=session.getAttribute("Seatto").toString();
                  CarType=session.getAttribute("CarType").toString();
                  ModelCar=session.getAttribute("ModelCar").toString();
                    
                    Collection collec=cb.SearchCar(Seatfrom,Seatto,condition,CarType,ModelCar);
                    request.setAttribute("carb",collec);
                    if(collec.size()>0)
                        {
                        %>
                           <div class="font">List Of Cars </div>    
                           <table width="100%" id="Table">  
                               <tr>
                                   <th>Image</th>
                                   <th>CarName</th>
                                   <th>Seats</th>
                                   <th>PriceDate</th>
                                   <th>Model</th>
                                   <th>Type</th>
                                   <th>Detail</th>
                               </tr>
                               <pg:paging pageSize="15" url="index.jsp?page=ResultSearchCar"  >
                                   <c:forEach items="${carb}" var="cr">
                                       <pg:item>
                                           <tr>
                                               <td class="td" width="60px"><img src="${cr.image}" width="60px" height="40px" /></td>
                                               <td class="td">${cr.carName}</td>
                                               <td class="td">${cr.seating}</td>
                                               <td class="td"><f:formatNumber value="${cr.priceDate}" pattern="$#,###"/> </td>
                                               <td class="td">${cr.modelName}</td>
                                               <td class="td">${cr.carType}</td>    
                                               <td class="td" width="80px"><a href="index.jsp?page=DetailCar&id=${cr.carID}" class="a" />View Detail</a></td>
                                           </tr>
                                       </pg:item>       
                                   </c:forEach>
                                   <pg:index>
                                       <pg:page><%=thisPage%></pg:page>
                                   </pg:index>
                               </pg:paging> 
                           </table>
                        <%
                        }
                        else
                            {
                            %>
                            <div class="font center">Not Found!</div>    
                            <%
                            }
        %>        
    </body>
</html>